#!/usr/bin/env python3
from optparse import OptionParser
from ase.calculators.jacapo import Jacapo
from Scientific.IO.NetCDF import NetCDFFile as NetCDF

parser = OptionParser(usage='stripnetcdf',
                      version='0.1')

options,args = parser.parse_args()

for arg in args:

    #check if it is a dacapo file
    nc = NetCDF(arg,'r')
    if hasattr(nc,'history'):
        if nc.history != 'Dacapo':
            nc.close()
            continue
    else:
        nc.close()
        continue

    calc = Jacapo(arg)
    calc.strip()
    print('stripped %s' % arg)

